# Maintainer: Michał Adamski <michal@ert.pl>
pkgname=btcd
pkgver=0.23.4
_pkgver=${pkgver/_/-}
pkgrel=3
pkgdesc="Alternative full node bitcoin implementation written in Go"
url="https://github.com/btcsuite/btcd#btcd"
arch="all"
license="ISC"
makedepends="go"
source="https://github.com/btcsuite/btcd/archive/v$_pkgver/btcd-$_pkgver.tar.gz"
builddir="$srcdir/$pkgname-$_pkgver"

# secfixes:
#   0.23.3-r0:
#     - CVE-2022-39389

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	mkdir bin
	go build -trimpath -v -o bin . ./cmd/...
}

check() {
	export GOFLAGS="${GOFLAGS/-trimpath/}"
	go test ./...
}

package() {
	for bin in bin/*; do
		install -Dm755 $bin "$pkgdir"/usr/$bin
	done
}
sha512sums="
aa6c40d58d8d4e7302005fa80b192a8f0298707d67685273e2b57cc339f2a999ea1953215f1a89c0480ea926dc6a55740c243656b67ca3b9d494b05f06537880  btcd-0.23.4.tar.gz
"
